import React from "react";
import { useSetAtom } from "jotai";
import { editorStateAtom } from "../state/editor-state";
import { type HistoryItem, historyRolledBackToAtom } from "../state/history";
import getEditorStateClass from "../state/get-editor-state";
import {Editor} from "@valuation/core";

export type rollbackHistoryFn = (
  historyItem: HistoryItem,
  historyItemIndex: number
) => void;
export function useRollbackHistory(editorView: Editor): rollbackHistoryFn {
  const setHistoryRolledBackTo = useSetAtom(historyRolledBackToAtom);
  const setEditorState = useSetAtom(editorStateAtom);
  const rollbackHistory = React.useCallback(
    (historyItem: HistoryItem, historyItemIndex: number) => {},
    [editorView]
  );

  return rollbackHistory;
}
